<?PHP
  class Login extends Editor{
    function __construct($page){
      $this->page = $page;
    }
  
    public function display(){
        ?>
            <h2>Login</h2>
        <?PHP
        if(isset($_POST['name']) && $_POST['name']){
            if($_SESSION['user']->login($_POST['name'],$_POST['password'])){
                echo "Hallo ".$_SESSION['user']->name;
?>
<script language="JavaScript"><!--
var zeit=(new Date()).getTime(); 
var stoppZeit=zeit+4000; 
while((new Date()).getTime()<stoppZeit){}; 
window.location.href="<?PHP Settings::getInstance()->get("host"); ?>admin/home.html";
// --></script> 
<?PHP
            }
            else{
                echo "Login fehlgeschlagen!";
            }
        }
        if($_SESSION['user']->isGuest()){
            ?>
            <form action="<?PHP echo $_SERVER['REQUEST_URI']; ?>" method="POST">
                <table>
                    <tr>
                        <td>Benutzername:</td>
                        <td><input name="name" /></td>
                    </tr>
                    <tr>
                        <td>Passwort:</td>
                        <td> <input name="password" type="password" /></td>
                    </tr>
                </table>
                <input type="submit" value="Login" />
            </form>
            <?PHP
        }
        else{
?>
<script language="JavaScript"><!--
window.location.href="<?PHP Settings::getInstance()->get("host"); ?>admin/home.html";
// --></script> 
<?PHP
        }
    }
    function getHeader(){
    }
    
    public function getEditableCode(){
      return "<input name=\"save\" type=\"submit\" value=\"&Auml;ndern\" onclick=\"form.action='".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."' ; target='_self' ; return true\" />";
    }
    
    public function save($newPage,$oldPage){
    }    
}
?>